package com.leenleda.ips.util;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.leenleda.ips.entity.CustomizedType;

import java.util.Map;

public class GsonUtils {


    public static Gson instance;

    public static Gson getInstance() {

        if (instance == null){
            GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.registerTypeAdapter(new TypeToken<Map<String, Object>>() {}
                    .getType(), new CustomizedType());
            instance = gsonBuilder.create();
        }
        return instance;
    }
}